package cn.fl.capital.transform;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.capital.dto.CapPayListRepDTO;
import cn.fl.capital.dto.CapPayTypNmValDTO;
import cn.fl.capital.vo.CapPayListRepVO;
import cn.fl.capital.vo.CapPayTypNmValVO;

import java.util.ArrayList;
import java.util.List;

/**
 * Function:
 * Created by Administrator on 2017/10/26.
 */
public class CapPayTypNmValVOTransform {

    /**
     * DTO 转  VO
     * @param dto CapPayTypNmValDTO
     * @return CapPayTypNmValVO
     */
    public static CapPayTypNmValVO toVO(CapPayTypNmValDTO dto) {
        CapPayTypNmValVO vo = null;
        if(dto != null){
            vo = new CapPayTypNmValVO();
            vo.setFlowKey(dto.getFlowKey());
            vo.setFlowNm(dto.getFlowNm());
            vo.setPayTypCd(dto.getPayTypCd());
        }
        return vo;
    }

    /**
     * VO 转 DTO
     * @param vo CapPayTypNmValVO
     * @return CapPayTypNmValDTO
     */
    public static CapPayTypNmValDTO toDTO(CapPayTypNmValVO vo) {
        CapPayTypNmValDTO dto = null;
        if(vo != null){
            dto = new CapPayTypNmValDTO();
            dto.setFlowKey(vo.getFlowKey());
            dto.setFlowNm(vo.getFlowNm());
            dto.setPayTypCd(vo.getPayTypCd());
        }
        return dto;
    }


    /**
     * DTO集合 转 VO集合
     * @param list List<CapPayTypNmValDTO>
     * @return List<CapPayTypNmValVO>
     */
    public static List<CapPayTypNmValVO> toVOList(List<CapPayTypNmValDTO> list) {
        List<CapPayTypNmValVO>  voList = new ArrayList<>();
        if(CollectionUtils.isNotEmpty(list)){
            for (CapPayTypNmValDTO dto : list) {
                voList.add(toVO(dto));
            }
        }
        return voList;
    }

    /**
     *  VO集合 转 DTO集合
     * @param list List<CapPayTypNmValVO>
     * @return List<CapPayTypNmValDTO>
     */
    public static List<CapPayTypNmValDTO> toDTOList(List<CapPayTypNmValVO> list) {
        List<CapPayTypNmValDTO>  dtoList = new ArrayList<>();
        if(CollectionUtils.isNotEmpty(list)){
            for (CapPayTypNmValVO vo : list) {
                dtoList.add(toDTO(vo));
            }
        }
        return dtoList;
    }

}
